{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}


{% block title %}
<title>围脖blog -- 搜索结果</title>
{% endblock %}


{% block right %}
<div class="panel panel-default col-xs-12" style="padding-bottom: 20px;">
    <div class="panel-heading">
    	搜索结果
    </div>
	{% if posts == [] %}
	<div class="panel-body">
		<div class="alert alert-info">没有搜索到任何东西～</div>
	</div>
	{% else %}
	<ul class="list-group">
		{% for p in posts %}
		<li class="list-group-item col-xs-12">
				<a href="{{ url_for('main.post',id=p.id) }}"><h3 class="col-xs-12"><strong>{{ p.head }}</strong></h3></a>
				<p class="list-meta col-xs-12">
					<a href="{{ url_for('main.user_index',id=p.post_author.id) }}">
					<button type="button" class="btn btn-info btn-xs">
					<span class="glyphicon glyphicon-user"></span>
					作者：{{ p.post_author.username }}
					</button></a>
					<a href="{{ url_for('main.topic',topic=p.topic.topic) }}">
					<button type="button" class="btn btn-success btn-xs">
					<span class="glyphicon glyphicon-tags"></span>
					 {{ p.topic.topic }}
					</button></a>
					<button type="button" class="btn btn-default btn-xs" id="read">
					<span class="glyphicon glyphicon-eye-open"></span> {{ p.clink }}次阅读
					</button>
					<button type="button" class="btn btn-default btn-xs" id="time">
					<span class="glyphicon glyphicon-time"></span>
						<script>
						var weekday = moment('{{ p.timestamp }}').locale('zh-cn').format('YYYY-MM-DD HH:mm:ss'); 
						document.write(weekday);
						</script>					
					</button>
				</p>
		</li>
		{% endfor %}		
	</ul>
	{% endif %}
</div>{% endblock %}
